package com.fqgj.sentry.manage.dao.impl;

import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.sentry.manage.dao.McGroupManagerDao;
import com.fqgj.sentry.manage.entity.McGroupManagerEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

/**
 * User: ykpbean
 * Date: 2017-07-12
 * Time: 14:21:02.913
 */

@Repository
public class McGroupManagerDaoImpl extends AbstractBaseMapper<McGroupManagerEntity> implements McGroupManagerDao {

    @Override
    public List<McGroupManagerEntity> selectListByUserId(Long userId) {
        return this.getSqlSession().selectList(this.getStatement(".selectListByUserId"),userId);
    }

    @Override
    public McGroupManagerEntity selectByUserIdAndAppId(HashMap<String, Object> param) {
        return this.getSqlSession().selectOne(this.getStatement(".selectByUserIdAndappId"),param);
    }

    @Override
    public Integer deleteByUserId(Long userId) {
        return Integer.valueOf(this.getSqlSession().delete(this.getStatement(".deleteByUserId"),userId));
    }

    @Override
    public List<McGroupManagerEntity> findByRoleId(Long roleId) {
        return this.getSqlSession().selectList(this.getStatement(".findByRoleId"),roleId);
    }

    @Override
    public List<McGroupManagerEntity> selectByAppId(Long appId) {
        return this.getSqlSession().selectList(this.getStatement(".selectByAppId"),appId);
    }
}